#include "widget.h"
#include "ui_widget.h"
#include <QPainter>

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
}

Widget::~Widget()
{
    delete ui;
}

void Widget::paintEvent(QPaintEvent *event)
{
    (void)event;
    QPainter painter(this);

    QPixmap pixmap(":/zhizhu.png");

    // 基础绘制
    // painter.drawPixmap(0, 0, pixmap);

    // 图片缩放
    painter.drawPixmap(0, 0, 800, 600, pixmap);

    // 图片旋转 (0, 0) 进行旋转
    painter.rotate(180);
    // 将整个坐标系都反转了
    painter.translate(-800, -600);
    painter.drawPixmap(100, 100, 500, 300, pixmap);
}

